package cn.changsheng.csfenjie;

import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import cn.changsheng.csfenjie.command.ExaCommand;

public final class main extends JavaPlugin {
	private static main instance;
	public static String version;

	public static main getInstance() {
		return instance;
	}

	@Override
	public void onEnable() {
		version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
		instance = this;
		Bukkit.getPluginCommand("fj").setExecutor(new ExaCommand());
		saveDefaultConfig();
		saveDefaultResource("setting.yml");
	}

	private void saveDefaultResource(String name) {
		File configFile = new File(this.getDataFolder(), name);
		if (!configFile.exists()) {
			saveResource(name, false);
		}
	}
}
